import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

// ac路由模块
import { routes as acGeneralOverview } from "./routes/ac/general_overview";
import { routes as acDataManager } from "./routes/ac/data_manager";
import { routes as acWatchRuning } from "./routes/ac/watch_runing";
// holo路由模块
import { routes as holoGeneralOverview } from "./routes/holo/general_overview";
import { routes as holoDataManager } from "./routes/holo/data_manager";
import { routes as holoWatchRuning } from "./routes/holo/watch_runing";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    name: "home",
    component: () => import("@/App.vue"),
    // 默认展示什么页面
    redirect: { name: "holo" },
    children: [
      // AirCity页面
      {
        path: "ac",
        name: "ac",
        component: () => import("@/views/aircity/index.vue"),
        redirect: { name: "ac_general_overview" },
        // AirCity的子页面
        children: [
          // 总体概览路由配置
          acGeneralOverview,
          // 数据管理路由配置
          acDataManager,
          // 运行监控路由配置
          acWatchRuning
        ]
      },
      // holo页面
      {
        path: "holo",
        name: "holo",
        component: () => import("@/views/holo/index.vue"),
        redirect: { name: "holo_general_overview" },
        // holo的子页面
        children: [
          // 总体概览路由配置
          holoGeneralOverview,
          // 数据管理路由配置
          holoDataManager,
          // 运行监控路由配置
          holoWatchRuning
        ]
      }
    ]
  }
];

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
});

export default router;
